import pandas as pd

csv_gen = "../../../res/topic_gen.csv"
csv_rt = "../../../res/topic_rt.csv"
df_gen = pd.read_csv(csv_gen)
df_rt = pd.read_csv(csv_rt)

# 合并
df = pd.concat([df_gen, df_rt], ignore_index=True)
# 排序
# df = df.sort_values(by="seq")
df = df.sort_values(by="seq").reset_index(drop=True)    # reset_index 排序之后重置索引
print(df)

""" 
    seq             time        topic  rate
0     1  20250419_163010     /chassis    22
1     1  20250419_163010        /gnss    33
2     1  20250419_163010      /camera    44
7     1  20250419_165011     /gnss_rt    12
6     1  20250419_165011  /chassis_rt    11
8     1  20250419_165011   /camera_rt    13
5     2  20250419_163011      /camera    77
3     2  20250419_163011     /chassis    55
4     2  20250419_163011        /gnss    66
9     2  20250419_165012  /chassis_rt    21
10    2  20250419_165012     /gnss_rt    22
11    2  20250419_165012   /camera_rt    23
"""